package com.cqeec.ui;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class LendingFindPanel extends JPanel {
	JCheckBox cbIsbn;
	JCheckBox cbName;
	JCheckBox cbType;
	JCheckBox cbReaderid;
	JCheckBox cbReadername;
	JCheckBox cbTel;
	JCheckBox cbLendDate;
	JCheckBox cbBackDate;
	JCheckBox cbOptor;
	
	JLabel lbIsbn;
	JTextField txtIsbn;
	JLabel lbName;
	JTextField txtName;
	JLabel lbType;
	JComboBox Type;
	JLabel lbReaderid;
	JTextField txtReaderid;
	JLabel lbReadername;
	JTextField txtReadername;
	JLabel lbTel;
	JTextField txtTel;
	JLabel lbLendDate;
	JTextField txtstartLendDate, txtendLendDate;
	JLabel lbBackDate;
	JTextField txtstartBackDate, txtendBackDate;
	JLabel lbOptor;
	JTextField txtOptor;
	String flag = "";

	public LendingFindPanel() {
		LendingFrame.lbState.setText("状态：请输入查询条件");
		LendingFrame.returnBtn.setEnabled(true);
		LendingFrame.borrowBtn.setEnabled(false);
		LendingFrame.backBtn.setEnabled(false);
		LendingFrame.optBtn.setEnabled(false);
		LendingFrame.findBtn.setEnabled(true);
		this.setLayout(null);
		initGUI();
	}

	// GUI界面设置
	private void initGUI() {
		try {
			this.setPreferredSize(new java.awt.Dimension(443, 234));

			cbIsbn = new JCheckBox();
			this.add(cbIsbn);
			cbIsbn.setBounds(27, 25, 23, 17);
			lbIsbn = new JLabel();
			this.add(lbIsbn);
			lbIsbn.setText("图书编号:");
			lbIsbn.setBounds(50, 26, 72, 15);
			txtIsbn = new JTextField();
			this.add(txtIsbn);
			txtIsbn.setBounds(122, 23, 187, 22);

			cbName = new JCheckBox();
			this.add(cbName);
			cbName.setBounds(27, 65, 23, 17);
			lbName = new JLabel();
			this.add(lbName);
			lbName.setText("图书名称:");
			lbName.setBounds(50, 66, 72, 15);
			txtName = new JTextField();
			this.add(txtName);
			txtName.setBounds(122, 63, 187, 22);

			cbType = new JCheckBox();
			this.add(cbType);
			cbType.setBounds(27, 105, 23, 17);
			lbType = new JLabel();
			this.add(lbType);
			lbType.setText("图书类别:");
			lbType.setBounds(50, 106, 72, 15);
			ComboBoxModel xbBoxModel = new DefaultComboBoxModel(new String[] {
					"经济管理", "计算机", "文学", "小说", "社会科学", "考试辅导" });
			Type = new JComboBox();
			this.add(Type);
			Type.setModel(xbBoxModel);
			Type.setBounds(122, 103, 187, 22);
			
			cbReaderid = new JCheckBox();
			this.add(cbReaderid);
			cbReaderid.setBounds(27, 145, 23, 17);
			lbReaderid = new JLabel();
			this.add(lbReaderid);
			lbReaderid.setText("读者编号:");
			lbReaderid.setBounds(50, 146, 72, 15);
			txtReaderid = new JTextField();
			this.add(txtReaderid);
			txtReaderid.setBounds(122, 143, 187, 22);
			
			cbReadername = new JCheckBox();
			this.add(cbReadername);
			cbReadername.setBounds(27, 185, 23, 17);
			lbReadername = new JLabel();
			this.add(lbReadername);
			lbReadername.setText("读者姓名:");
			lbReadername.setBounds(50, 186, 72, 15);
			txtReadername = new JTextField();
			this.add(txtReadername);
			txtReadername.setBounds(122, 183, 187, 22);
			
			cbTel = new JCheckBox();
			this.add(cbTel);
			cbTel.setBounds(27, 225, 23, 17);
			lbTel = new JLabel();
			this.add(lbTel);
			lbTel.setText("联系电话:");
			lbTel.setBounds(50, 226, 72, 15);
			txtTel = new JTextField();
			this.add(txtTel);
			txtTel.setBounds(122, 223, 187, 22);
			
			cbLendDate = new JCheckBox();
			this.add(cbLendDate);
			cbLendDate.setBounds(27, 265, 23, 17);
			lbLendDate = new JLabel();
			this.add(lbLendDate);
			lbLendDate.setText("借阅日期:");
			lbLendDate.setBounds(50, 266, 72, 15);
			txtstartLendDate = new JTextField();
			txtstartLendDate.setToolTipText("输入格式：yyyy-MM-dd");
			this.add(txtstartLendDate);
			txtstartLendDate.setBounds(122, 263, 187, 22);
			JLabel label1 = new JLabel("至");
			this.add(label1);
			label1.setBounds(320, 266, 72, 15);
			txtendLendDate = new JTextField();
			txtendLendDate.setToolTipText("输入格式：yyyy-MM-dd");
			this.add(txtendLendDate);
			txtendLendDate.setBounds(345, 263, 187, 22);
			
			cbBackDate = new JCheckBox();
			this.add(cbBackDate);
			cbBackDate.setBounds(27, 305, 23, 17);
			lbBackDate = new JLabel();
			this.add(lbBackDate);
			lbBackDate.setText("归还日期:");
			lbBackDate.setBounds(50, 306, 72, 15);
			txtstartBackDate = new JTextField();
			txtstartBackDate.setToolTipText("输入格式：yyyy-MM-dd");
			this.add(txtstartBackDate);
			txtstartBackDate.setBounds(122, 303, 187, 22);
			JLabel label2 = new JLabel("至");
			this.add(label2);
			label2.setBounds(320, 306, 72, 15);
			txtendBackDate = new JTextField();
			txtendBackDate.setToolTipText("输入格式：yyyy-MM-dd");
			this.add(txtendBackDate);
			txtendBackDate.setBounds(345, 303, 187, 22);
			
			cbOptor = new JCheckBox();
			this.add(cbOptor);
			cbOptor.setBounds(27, 345, 23, 17);
			lbOptor = new JLabel();
			this.add(lbOptor);
			lbOptor.setText("经办人:");
			lbOptor.setBounds(50, 346, 72, 15);
			txtOptor = new JTextField();
			this.add(txtOptor);
			txtOptor.setBounds(122, 343, 187, 22);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
